<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

// all system related models

class system_model extends CI_Model{
	
	
	
//load  system settings from database
function LoadGlobalSettings(){
		 $temp = $this -> config -> item(SYS_SETTINGS);   //read system setting  
		 if (isset($temp)){  //check if glbal settings have been loaded already 
		 	if (count($temp)>1) {   
		 		return $temp; 
		 	}
		 }		 
		 
         $config = array();	
         $Query = $this ->db ->query('Select * from ts_settings');
         if ($Query->num_rows()>0){
               foreach ($Query->result() as $rows){   //read out all system parameters
                  $config[$rows ->para_name] = $rows ->value;
			   }
			   $this -> config -> set_item(SYS_SETTINGS, $config);
         }
         return $config;
}



}